package com.example.framework;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.Random;
import java.util.List;

import org.testng.annotations.DataProvider;

import com.example.framework.dataobjects.GroupObject;

public class GroupDataGenerator {

	Random rnd = new Random();
	
	@DataProvider(name="randomGroups")
	public Iterator<Object[]> generateRandomGroups(){
		List<Object[]> list = new ArrayList<Object[]>();
		for (int i = 0; i < 5; i++) {
			GroupObject group = new GroupObject().setName("name" + rnd.nextInt())
					.setHeader("header" + rnd.nextInt())
					.setFooter("footer" + rnd.nextInt());
			list.add(new Object[] {group});
		}
		return null;
		
	}
	
	@DataProvider(name="groupsFromFile")
	public Iterator<Object[]> loadGroupsFromFile(){
		List<Object[]> list = new ArrayList<Object[]>();
		for (int i = 0; i < 5; i++) {
			GroupObject group = new GroupObject().setName("name" + rnd.nextInt())
					.setHeader("header" + rnd.nextInt())
					.setFooter("footer" + rnd.nextInt());
			list.add(new Object[] {group});
		}
		return null;
		
	}
	
	public static void main(String[] args) {
		if(args.length < 2 ){
			System.out.println("Specify 2 parameters: file and count");
			return;
		}
		String file = args[0];
		int countTestData = Integer.parseInt(args[1]);
		new GroupDataGenerator().generateDataToFile(file, countTestData);
	}

	private void generateDataToFile(String file, int countTestData) {
		// TODO Auto-generated method stub
		
	}
}
